<template>
    <div>
        <SelectCustom v-if="!pageType" @confirm="toAddOrEdit"/>
        <Main :custId="custData.id" v-else/> 
    </div>
</template>

<script setup name="CustomerEdit">
import useCustAddOrEditStore from '@/store/modules/custAddOrEdit'
import SelectCustom from '../components/SelectCustom.vue'
import Main from './Main.vue'

const pageType =  computed(() => useCustAddOrEditStore().pageType);
const custData =  computed(() => useCustAddOrEditStore().custData);
const toAddOrEdit = custInfo => {
    const { editType, ...obj } = custInfo
    useCustAddOrEditStore().setCustData(obj)
    useCustAddOrEditStore().setPageType(editType)
    console.log(pageType.value, toRaw(custData.value));
}
</script>

<style lang="scss" scoped>
.item_box{
    overflow: hidden;
    position: relative;
    transition: all .5s;
    .isOpen{
        position: absolute;
        bottom: 10px;
        right: 20px;
    }
}
</style>